package b.i.b;

import android.app.Activity;
import android.app.Application.ActivityLifecycleCallbacks;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

/* compiled from: ActivityRecreator */
public final class e {
    public static final Class<?> a;
    public static final Field b;
    public static final Field c;
    public static final Method d;
    public static final Method e;
    public static final Method f;
    public static final Handler g = new Handler(Looper.getMainLooper());

    /* compiled from: ActivityRecreator */
    public static final class a implements ActivityLifecycleCallbacks {
        public Object a;
        public Activity b;
        public boolean c = false;
        public boolean d = false;
        public boolean e = false;

        public a(Activity activity) {
            this.b = activity;
        }

        public void onActivityCreated(Activity activity, Bundle bundle) {
        }

        public void onActivityDestroyed(Activity activity) {
            if (this.b == activity) {
                this.b = null;
                this.d = true;
            }
        }

        public void onActivityPaused(Activity activity) {
            if (this.d && !this.e && !this.c) {
                Object obj = this.a;
                Object obj2 = null;
                try {
                    Object obj3 = e.c.get(activity);
                    if (obj3 == obj) {
                        e.g.postAtFrontOfQueue(new d(e.b.get(activity), obj3));
                        obj2 = 1;
                    }
                } catch (Throwable th) {
                    Log.e("ActivityRecreator", "Exception while fetching field values", th);
                }
                if (obj2 != null) {
                    this.e = true;
                    this.a = null;
                }
            }
        }

        public void onActivityResumed(Activity activity) {
        }

        public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
        }

        public void onActivityStarted(Activity activity) {
            if (this.b == activity) {
                this.c = true;
            }
        }

        public void onActivityStopped(Activity activity) {
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:25:0x005d A:{SYNTHETIC, Splitter:B:25:0x005d} */
    static {
        /*
        r0 = java.lang.Boolean.TYPE;
        r1 = new android.os.Handler;
        r2 = android.os.Looper.getMainLooper();
        r1.<init>(r2);
        g = r1;
        r1 = 0;
        r2 = "android.app.ActivityThread";
        r2 = java.lang.Class.forName(r2);	 Catch:{ all -> 0x0015 }
        goto L_0x0016;
    L_0x0015:
        r2 = r1;
    L_0x0016:
        a = r2;
        r2 = 1;
        r3 = android.app.Activity.class;
        r4 = "mMainThread";
        r3 = r3.getDeclaredField(r4);	 Catch:{ all -> 0x0025 }
        r3.setAccessible(r2);	 Catch:{ all -> 0x0025 }
        goto L_0x0026;
    L_0x0025:
        r3 = r1;
    L_0x0026:
        b = r3;
        r3 = android.app.Activity.class;
        r4 = "mToken";
        r3 = r3.getDeclaredField(r4);	 Catch:{ all -> 0x0034 }
        r3.setAccessible(r2);	 Catch:{ all -> 0x0034 }
        goto L_0x0035;
    L_0x0034:
        r3 = r1;
    L_0x0035:
        c = r3;
        r3 = a;
        r4 = 3;
        r5 = "performStopActivity";
        r6 = 2;
        r7 = 0;
        if (r3 != 0) goto L_0x0042;
    L_0x0040:
        r3 = r1;
        goto L_0x0055;
    L_0x0042:
        r8 = new java.lang.Class[r4];	 Catch:{ all -> 0x0040 }
        r9 = android.os.IBinder.class;
        r8[r7] = r9;	 Catch:{ all -> 0x0040 }
        r8[r2] = r0;	 Catch:{ all -> 0x0040 }
        r9 = java.lang.String.class;
        r8[r6] = r9;	 Catch:{ all -> 0x0040 }
        r3 = r3.getDeclaredMethod(r5, r8);	 Catch:{ all -> 0x0040 }
        r3.setAccessible(r2);	 Catch:{ all -> 0x0040 }
    L_0x0055:
        d = r3;
        r3 = a;
        if (r3 != 0) goto L_0x005d;
    L_0x005b:
        r3 = r1;
        goto L_0x006c;
    L_0x005d:
        r8 = new java.lang.Class[r6];	 Catch:{ all -> 0x005b }
        r9 = android.os.IBinder.class;
        r8[r7] = r9;	 Catch:{ all -> 0x005b }
        r8[r2] = r0;	 Catch:{ all -> 0x005b }
        r3 = r3.getDeclaredMethod(r5, r8);	 Catch:{ all -> 0x005b }
        r3.setAccessible(r2);	 Catch:{ all -> 0x005b }
    L_0x006c:
        e = r3;
        r3 = a;
        r5 = a();
        if (r5 == 0) goto L_0x00ab;
    L_0x0076:
        if (r3 != 0) goto L_0x0079;
    L_0x0078:
        goto L_0x00ab;
    L_0x0079:
        r5 = "requestRelaunchActivity";
        r8 = 9;
        r8 = new java.lang.Class[r8];	 Catch:{ all -> 0x00ab }
        r9 = android.os.IBinder.class;
        r8[r7] = r9;	 Catch:{ all -> 0x00ab }
        r7 = java.util.List.class;
        r8[r2] = r7;	 Catch:{ all -> 0x00ab }
        r7 = java.util.List.class;
        r8[r6] = r7;	 Catch:{ all -> 0x00ab }
        r6 = java.lang.Integer.TYPE;	 Catch:{ all -> 0x00ab }
        r8[r4] = r6;	 Catch:{ all -> 0x00ab }
        r4 = 4;
        r8[r4] = r0;	 Catch:{ all -> 0x00ab }
        r4 = 5;
        r6 = android.content.res.Configuration.class;
        r8[r4] = r6;	 Catch:{ all -> 0x00ab }
        r4 = 6;
        r6 = android.content.res.Configuration.class;
        r8[r4] = r6;	 Catch:{ all -> 0x00ab }
        r4 = 7;
        r8[r4] = r0;	 Catch:{ all -> 0x00ab }
        r4 = 8;
        r8[r4] = r0;	 Catch:{ all -> 0x00ab }
        r0 = r3.getDeclaredMethod(r5, r8);	 Catch:{ all -> 0x00ab }
        r0.setAccessible(r2);	 Catch:{ all -> 0x00ab }
        r1 = r0;
    L_0x00ab:
        f = r1;
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.i.b.e.m457clinit():void");
    }

    public static boolean a() {
        int i = VERSION.SDK_INT;
        return i == 26 || i == 27;
    }
}
